// pages/auth/index.js
import {request} from "../../request/index.js"
import regeneratorRuntime from '../../lib/runtime/runtime'
import {login} from '../../utils/asyncWx'
Page({
    data:{
       messaage:{
              "user_id": 23,
                "user_email_code": null,
                "is_active": null,
                "user_sex": "男",
                "user_qq": "",
                "user_tel": "",
                "user_xueli": "本科",
                "user_hobby": "",
                "user_introduce": null,
                "create_time": 1562221487,
                "update_time": 1562221487,
                "token": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo"
  },
       
    },

    async handleGetuserinfo(e){
       try {
            const {encryptedData,iv,rawData,signature}=e.detail
       const {code}=await login()
       const loginParams={encryptedData,iv,rawData,signature,code}
       //不是企業開發，拿不到token，數據模擬
    //    const res=await request({
    //        url:"https://api-hmugo-web.itheima.net/api/public/v1/users/wxlogin",
    //        data:loginParams,methods:"post"
         
    //    })
       let token=this.data.messaage.token     
        wx.setStorageSync("token", token);
        wx.navigateTo({
            url: '/pages/pay/index',
           
        });
          console.log(token);
           
       } catch (error) {
           console.log(error);
       }
          
        
          
    }
})